/**
 * 
 */
package ccrClasses.layer2;

import ccrClasses.ICcr;

/**
 * <Value> can be either a string or an integer, depending on the context.
 * @author matheus
 *
 */
public class Value implements ICcr{
	
	public static String OPEN_TAG = "<Value>";

	public static String CLOSE_TAG = "</Value>";
	
	private String valueString = null;
	
	private Integer valueInteger = -1;

	public Value(String value, Integer value2) {
		super();
		this.valueString = value;
		this.valueInteger = value2;
	}
	
	public Value(String value) {
		super();
		this.valueString = value;		
	}
	
	public Value(Integer value2) {
		super();		
		this.valueInteger = value2;
	}

	public Value() {
		super();
	}

	/**
	 * @return the value
	 */
	public String getValue() {
		return valueString;
	}

	/**
	 * @param value the value to set
	 */
	public void setValue(String value) {
		this.valueString = value;
	}

	/**
	 * @return the value2
	 */
	public Integer getValue2() {
		return valueInteger;
	}

	/**
	 * @param value2 the value2 to set
	 */
	public void setValue2(Integer value2) {
		this.valueInteger = value2;
	}

	@Override
	public String constructCcrString() {
				
		if(valueString != null){
			return new String(OPEN_TAG + valueString + CLOSE_TAG);
		}
		
		if(valueInteger != -1){
			return new String(OPEN_TAG + valueInteger + CLOSE_TAG);
		}
		
		return new String(OPEN_TAG+CLOSE_TAG);
	}
	
	

}
